﻿using UnityEngine;
using System.Collections;

public class Apple : MonoBehaviour {

    private Snake _snake;

    void Start()
    { 
        _snake = GameObject.Find("Snake").GetComponent<Snake>();
    }
    void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == "Snake")
        {
            AppleFactory._instance.SendMessage("Create");
            _snake.SendMessage("Grow");
            RealManager._instance.SetScore(1);
            GameObject.Destroy(this.gameObject);
        }
    }
}
